package com.laizhenghua.wxstub.utils;

import java.util.HashMap;

/**
 * @description: 统一返回类封装
 * @author: laizhenghua
 * @date: 2022/5/4 17:08
 */
public class R extends HashMap<String, Object> {
    private static final long serialVersionUID = 7544970606031112807L;
    public R() {
        this.put("msg", "success");
        this.put("code", 200);
    }
    public static R ok() {
        return new R();
    }
    public static R error(Integer code, String msg) {
        R r = new R();
        r.put("msg", msg);
        r.put("code", code);
        return r;
    }
    public R put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
